home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
System Booster
/
System Booster.iso
/
Systemmonitors
/
SWAP
/
PatchSignaling.s
next >
Wrap
Text File
|
1996-09-26
|
3KB
|
129 lines
;PatchSignaling.s .Copyright © Kamran Karimi.It Patches the EXEC functions
;PutMsg() and Signal() to prevent them of awakening a swapped out program.
;Assembled with Cape. Should be linked with SWAP.o to produce executable
ExecBase equ 4
AllocMem equ -198
FreeMem equ -210
Signal equ -322
PutMsg equ -364
XDEF _PatchSignaling
XDEF _ReservedSignal
XDEF _ReservedPutMsg
XDEF _SignalAddr
XDEF _PutMsgAddr
XDEF _SaveSignal
XDEF _SavePutMsg
XDEF _SizeOfPatchSignal
XDEF _SizeOfPatchPutMsg
_PatchSignaling:
move.l a6,-(a7)
move.l ExecBase,a6
adda.l #Signal,a6
move.l a6,_SignalAddr
move.l ExecBase,a6
adda.l #PutMsg,a6
move.l a6,_PutMsgAddr
move.l ExecBase,a6
move.l Signal(a6),_SaveSignal
move.l PutMsg(a6),_SavePutMsg
move.l #EndePatchSignal-BeginPatchSignal,d0
move.l d0,_SizeOfPatchSignal
move.l #$10001,d1
jsr AllocMem(a6)
move.l d0,_ReservedSignal
beq End_Main
move.l #EndePatchPutMsg-BeginPatchPutMsg,d0
move.l d0,_SizeOfPatchPutMsg
move.l #$10001,d1
jsr AllocMem(a6)
move.l d0,_ReservedPutMsg
bne MemAllocated
move.l _ReservedSignal,a1
move.l _SizeOfPatchSignal,d0
jsr FreeMem(a6)
bra End_Main
MemAllocated:
move.l Signal(a6),_SavePatchSignal
move.l #BeginPatchSignal,a0
move.l _ReservedSignal,a1
move.l _SizeOfPatchSignal,d0
divu #2,d0
subi.l #1,d0
lop1:
move.w (a0)+,(a1)+
dbra d0,lop1
move.l _ReservedSignal,Signal(a6)
move.l PutMsg(a6),_SavePatchPutMsg
move.l #BeginPatchPutMsg,a0
move.l _ReservedPutMsg,a1
move.l _SizeOfPatchPutMsg,d0
divu #2,d0
subi.l #1,d0
lop2:
move.w (a0)+,(a1)+
dbra d0,lop2
move.l _ReservedPutMsg,PutMsg(a6)
moveq #0,d0
bra Payan
End_Main:
move.l #10,d0
Payan: ;in Persian (Parsi or Farsi, as we call it) means end
move.l ExecBase,a6
move.l (a7)+,a6
rts
_ReservedSignal: dc.l 0
_ReservedPutMsg: dc.l 0
_SizeOfPatchSignal: dc.l 0
_SizeOfPatchPutMsg: dc.l 0
_SignalAddr: dc.l 0
_PutMsgAddr: dc.l 0
_SaveSignal: dc.l 0
_SavePutMsg: dc.l 0
BeginPatchSignal:
movem.l d1/a1,-(a7)
move.b 15(a1),d1
cmp.b #9,d1
bne GoOnSignal
movem.l (a7)+,d1/a1
rts
GoOnSignal:
movem.l (a7)+,d1/a1
move.l _SavePatchSignal(pc),-(a7)
rts
_SavePatchSignal: dc.l 0
EndePatchSignal:
BeginPatchPutMsg:
movem.l d0/a0,-(a7)
move.l 16(a0),a0
move.b 15(a0),d0
cmp.b #9,d0
bne GoOnPutMsg
movem.l (a7)+,d0/a0
rts
GoOnPutMsg:
movem.l (a7)+,d0/a0
move.l _SavePatchPutMsg(pc),-(a7)
rts
_SavePatchPutMsg: dc.l 0
EndePatchPutMsg: